package chapter17;

import java.util.ArrayList;
import java.util.LinkedHashSet;

import chapter15.Fibonacci;
import chapter15.Generator;

public class CollectionData<T> extends ArrayList<T> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private CollectionData(Generator<T> gen,int quantity)
	{
		for(int i=0;i<quantity;i++)
			add(gen.next());
	}
	
	public static <T> CollectionData<T> list(Generator<T> gen,int quantity)
	{
		return new CollectionData<>(gen, quantity);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		LinkedHashSet<Integer> list=new LinkedHashSet<>();
		list.addAll(list(new Fibonacci(),10));
		System.out.println(list);

	}

}
